require 'rake/testtask'
require 'rdoc/task'

spec = eval(File.read("digest-ed2k.gemspec"))
source = FileList["lib/**/*.rb"]

begin
    # why is require documented to return true/false
    # if it raises LoadError when it should return false
    require 'yard'

    YARD::Rake::YardocTask.new do |yd|
        yd.files = source
    end

    task :doc => :yard
rescue LoadError
    task :doc => :rdoc
end

RDoc::Task.new do |rd|
    rd.rdoc_files = source
end

Rake::TestTask.new do |t|
  t.libs << 't'
  t.test_files = spec.test_files
  t.verbose = false
end

task :default => :test
